import random

def generate_id_card():
    # 生成一个随机的身份证号码
    id_card = ''.join(random.choices('0123456789', k=17))
    id_card += 'x' if random.choice([True, False]) else random.choice('0123456789')
    return id_card

def main():
    # 生成随机的 n 和 m
    n = random.randint(20000, int(20000))
    m = random.randint(20000, int(20000))
    k = random.randint(100, 500)

    # 生成 n 行身份证数据
    with open("random_data.txt", "w") as file:
        file.write(f"{n} {k}\n")
        # file.write("随机生成的身份证数据（n 行）：\n")
        for _ in range(n):
            id_card = generate_id_card()
            number = random.randint(1, 1500)
            file.write(f"{id_card} {number}\n")
        file.write(f"{m}\n")
        # 生成 m 行身份证数据
        # file.write("\n随机生成的身份证数据（m 行）：\n")
        for _ in range(m):
            id_card = generate_id_card()
            file.write(f"{id_card}\n")

if __name__ == "__main__":
    main()
